Dreamweaver Article

Migrating from Microsoft FrontPage to Macromedia Dreamweaver MX 2004


Table of Contents

  1. Introduction
  2. Introducing the Dreamweaver Workspace
  3. Streamlining Your Workspace
  4. Setting Up a Web and Managing Files
  5. Working with Text
  6. Working with Styles and Style Sheets
  7. Working with Images
  8. Creating Links
  9. Creating Tables
  10. Using Layout Mode to Position Text and Images
  11. Using Predesigned Pages to Get a Head Start
  12. Making Quick Edits to Code
  13. Working in Code View
  14. Editing Code in Code View
  15. Customizing Your Coding Environment
  16. Taking the Next Steps

Working With Styles and Style Sheets

Styles are often used in FrontPage and Word to format text and paragraphs. If you’re used to working with styles, you can keep working with them in Dreamweaver.

Dreamweaver creates a CSS style when you format a text selection (see Working with text). CSS stands for Cascading Style Sheet, a web technology that gives you precise control over the appearance of your web pages. In addition to formatting text, CSS styles let you set margins, borders, float text around other text, and so on.

Like FrontPage or Word styles, CSS styles make it easy to update the formatting of your pages. When you update a CSS style, it automatically updates the formatting of all page elements using that style. In Dreamweaver, you can choose from numerous predefined CSS styles sheets or you can create your own styles.

To create a new style:

  1. In the CSS Styles panel (Window > CSS Styles), click the New CSS Style button (+) on the bottom of the panel.

    The New CSS Style dialog box appears.

    The New CSS Style dialog box

    Figure 15. The New CSS Style dialog box

  2. Select a selector type.

    Dreamweaver supports class selectors and tag selectors. A class selector defines a new named style, such as myBodyText. Once defined, you can apply the myBodyText style to any text selection.

    A tag selector applies to all HTML tags of a particular type. For example, if you select the table row tag, tr, and set the font to Helvetica; this then applies the Helvetica font automatically to all table rows.

  3. Select the location where you want to define the new style, as follows:

    • To define the style in a new external style sheet, select New Style Sheet File.
    • To define the style in an existing style sheet attached to the current document, select the CSS file from the Define In pop-up menu.
    • To embed the style in the current document, select This Document Only.
  4. Click OK.

    The New CSS Style dialog box closes and the Style Definition dialog box opens.

    The CSS Style definition dialog box

    Figure 16. The CSS Style definition dialog box

  5. Use the Style Definition dialog box options to define the new CSS style.
  6. When you’re done, click OK.

To use a predefined style sheet:

  1. Choose File > New to open the New Document dialog box.
  2. In the Category list, select CSS Style Sheets.
  3. In the CSS Style Sheets list, select the style sheet you want. Dreamweaver displays a preview of the styles as well as a brief description of the style sheet.

    The Styles preview dialog box

    Figure 17. The Styles preview dialog box

  4. To create the style sheet, click Create or double-click the item in the list. The style sheet appears in code format in the Document window.
  5. Choose File > Save to save the document.

    Before you can apply the styles defined in an external style sheet, you must attach the style sheet to your pages.

To attach a style sheet to your pages:

  1. Open a page and then open the CSS Styles panel (Window > CSS Styles).
  2. Click the Attach Style Sheet button at the bottom of the CSS Styles panel.

    The Attach Style Sheet button

    Figure 18. The Attach Style Sheet button

  3. Browse to the style sheet and select it.

The individual styles appear in the CSS Styles panel. They also appear in the Style pop-up menu in the Property inspector.

The Property inspector style pop-up menu

Figure 19. The Property inspector style pop-up menu

To apply styles:

Click or select a page element and do one of the following:

  • In the Property inspector, select the style from the Style pop-up menu.
  • Right-click the selection in Design view and select the style from the CSS Styles submenu in the context menu.
  • In the CSS Styles panel (Window > CSS Styles), right-click the style you want to apply and select Apply from the context menu.

To modify styles:

  1. In the CSS Styles panel (Window > CSS Styles), select the style you want to modify.
  2. Click the Edit Style button at the bottom of the CSS Styles panel.

    The Edit Style button

    Figure 20. The Edit Style button

  3. Modify the style attributes in the Style Definition dialog box.

    The CSS Style Definition dialog box

    Figure 21. The CSS Style Definition dialog box

  4. Click OK.

For more information, see the following topics in Using Dreamweaver Help:

  • "Linking to or importing an external CSS style sheet"
  • "Creating a new CSS style"
  • "Editing a CSS style sheet"
  • "Editing a CSS style"